using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GG_ScreenConsole;
using System.Reflection;

//Open the console with Tab, Execute with Enter

namespace GG_ScreenConsole_Demo
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        public static Vector2 PlayerPos = new Vector2(); //Try changing this with the console!
        public static ScreenConsole SC;
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }
        protected override void Initialize()
        {
            //I suggest you create
            //a class to hold all
            //of the things you want
            //to let the console do
            //in a seperate assembly
            //then pass that in here.
            //You can pass in multiple
            //if you want.
            SC = new ScreenConsole(
                Content.Load<SpriteFont>("Font10"),
                new List<Assembly>() { 
                    Assembly.GetAssembly(typeof(Game1))
                    },
                1000,
                Content.Load<Texture2D>("Pixel"),
                Keys.Tab,
                Keys.Enter
                );
            SC.Bounds = new Rectangle(0, 0, 800, 200);
            base.Initialize();
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
        }
        protected override void UnloadContent()
        {
        }
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();
            SC.Update();
            base.Update(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Gray);
            spriteBatch.Begin();
            spriteBatch.Draw(Content.Load<Texture2D>("Player"), PlayerPos, Color.White);
            SC.Draw(spriteBatch);
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}